<?php
namespace app\api\controller;
use app\common\controller\Api;
use app\api\model\Advert as AdvertModel;

class Advert extends Api
{
    public function getOne()
    {
        $res = AdvertModel::with('picture')->where(['status' => 1])->field('id, cover')->find();
        return $res;
    }

    public function info($id)
    {
        $res = model('Advert')->where(['status' => 1, 'id' => $id])->find();
        $res['content'] = htmlentities($res['content']);
        return $res;
    }
}
